import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        users: [],
        departments: []
    },
    mutations: {
        SET_USERS(state, users) {
            state.users = users
        },
        SET_DEPARTMENTS(state, departments) {
            state.departments = departments
        }
    },
    actions: {
        setUsers({ commit }, users) {
            commit('SET_USERS', users)
        },
        setDepartments({ commit }, departments) {
            commit('SET_DEPARTMENTS', departments)
        }
    },
    getters: {
        users: state => state.users,
        departments: state => state.departments
    }
}) 